package com.ykdl.member.kid.adapters;

import com.lidroid.xutils.BitmapUtils;
import com.ykdl.member.kid.R;
import com.ykdl.member.kid.adapters.ArticlesAdapter.ViewHolder;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class StoreCouponAdapter extends BaseAdapter{
    
	private BitmapUtils bitmapUtil;
	private Context mContext ;
	public StoreCouponAdapter(Context context){
		mContext = context;
		bitmapUtil = new BitmapUtils(context);
		bitmapUtil.configDefaultLoadingImage(R.drawable.defult_head_icon);
		bitmapUtil.configDefaultLoadFailedImage(R.drawable.defult_head_icon);
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 3;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder = null;
		if (convertView == null) {
			convertView=RelativeLayout.inflate(mContext,
					R.layout.store_couponadapter_item, null);
			holder=new ViewHolder();
			holder.left=(LinearLayout) convertView.findViewById(R.id.left);
			holder.coupon_receive= (Button) convertView.findViewById(R.id.coupon_receive);
			holder.yh_method=(TextView) convertView.findViewById(R.id.yh_method);
			holder.quan_number=(TextView) convertView.findViewById(R.id.quan_number);
			holder.store_name=(TextView) convertView.findViewById(R.id.store_name);
			convertView.setTag(holder);
		}else{
			holder=(ViewHolder) convertView.getTag();
		}
//		holder.left.setBackgroundColor(color);
		holder.left.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Toast.makeText(mContext, "左边", 0).show();
			}
		});
		
		holder.coupon_receive.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Toast.makeText(mContext, "右边", 0).show();
			}
		});
		
		return convertView;
	}
	class ViewHolder {
		Button coupon_receive;
		LinearLayout left;
		TextView yh_method;
		TextView quan_number;
		TextView store_name;
	}

}
